package com.qlylkj.lbk.model.api


sealed class ResultResponse<out T : Any> {

    data class Success(val message: String) : ResultResponse<Nothing>()
    data class SuccessEntity<T : Any>(val data: T) : ResultResponse<T>()
    data class SuccessList< T : Any>(val data: MutableList<T>) : ResultResponse<MutableList<T>>()
    data class LoginFailure(val fail: String) : ResultResponse<Nothing>()
    data class Error(val exception: Exception) : ResultResponse<Nothing>()

    override fun toString(): String {
        return when (this) {
            is Success -> "Success[message=$message]"
            is SuccessEntity<*> -> "Success[data=$data]"
            is SuccessList<*> -> "Success[data=$data]"
            is LoginFailure -> "Error[fail=$fail]"
            is Error -> "Error[exception=$exception]"
        }
    }
}